package model;

import java.awt.Toolkit;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.ClipboardOwner;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.StringSelection;
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.io.IOException;

public class Editar {
	Toolkit toolkit = Toolkit.getDefaultToolkit();
	Clipboard clipboard = toolkit.getSystemClipboard();
	
	public void selecionar()
	{
		
	}
	
	
	public void copiar(String texto)
	{
		ClipboardOwner selection = new StringSelection(texto);
        clipboard.setContents((Transferable) selection, selection);
	}
	
	public String colar()
	{
		Transferable contents = clipboard.getContents(this);
		try{
			return (String) contents.getTransferData(DataFlavor.stringFlavor);
		}catch (UnsupportedFlavorException exUF){
		}catch (IOException exIO){
		}
		return null;
	}
	
	public void recortar(String texto)
	{
		copiar(texto);
	}
}
